package com.egg.demo.service.sensitive.impl;

import com.egg.auth.feign.AuthRoleFeignClient;
import com.egg.common.core.model.response.ResponseData;
import com.egg.common.spring.service.SensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 脱敏服务
 * 默认管理员不过滤
 * 需自行根据业务重写实现
 *
 */
//@Service
public class DemoSensitiveServiceImpl implements SensitiveService {


    @Autowired(required = false)
    private AuthRoleFeignClient authRoleFeignClient;


    /**
     * 是否脱敏
     *
     */
    @Override
    public boolean isSensitive() {
        ResponseData<Boolean> rd = authRoleFeignClient.hasAdminGet();
        if (rd.isError()) {
            return true;
        }
        return !rd.getData();
    }

}
